147 - Dollars (Programación dinámica, DP, coin change)
[andmenj-acm.git] / 11387 - The 3-Regular Graph / p11387.cpp
blobcae8e0ef559aa3abe9a1b0094b506c6699b597e1
1 #include <iostream>
3 using namespace std;
5 int main(){
6 int n;
7 cin >> n;
8 while (n){
9 //procesar caso
10 if (n <= 3 || n % 2 == 1){
11 cout << "Impossible\n";
12 }else{
13 int mitad = n / 2;
14 cout << mitad * 3 << endl; // # of edges
15 for (int i=1; i<n; ++i){
16 cout << i << " " << i+1 << endl; //borde
18 cout << n << " 1" << endl; // cerrar borde
19 for (int i=1; i<= mitad; ++i){
20 cout << i << " " << i+mitad << endl;
23 cin >> n;
25 return 0;